#pragma once

#include <iostream>
#include <functional>
#include <string>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
#include <memory>
#include <cstring>
#include <cstdlib>
#include "Common.hpp"
#include "Log.hpp"

enum ExitCode
{
    OK = 0,
    USAGE_ERR,
    SOCKET_ERR,
    BIND_ERR,
    LISTEN_ERR,
    ACCEPT_ERR,
    CLOSE_ERR,
    RECV_ERR,
    SEND_ERR,
    MEM_ERR,
    TIMEOUT_ERR,
    UNKNOWN_ERR,
    CONNECT_ERR,
    FORK_ERR,
    OPEN_ERR
};

class NoCopy
{
public:
    NoCopy() = default;
    ~NoCopy() = default;
    NoCopy(const NoCopy&) = delete;
    NoCopy& operator=(const NoCopy&) = delete;
    const NoCopy &operator=(const NoCopy&) const = delete;
};

#define CONV(addr) ((struct sockaddr*)&addr)